import { reqGetSearchList } from '@/api'

export default {

  namespaced: true,

  state: {
    // 服务器响应回来的数据
    searchList: {}

  },

  actions: {
    async getSearchList({ commit }, params = {}) {
      const result = await reqGetSearchList(params)
      if (result.code === 200) {
        commit('GETSEARCHLIST', result.data)
      }
    }
  },

  mutations: {

    GETSEARCHLIST(state, searchlist) {
      state.searchList = searchlist
    }
  },

  getters: {
    goodsList(state) {
      return state.searchList.goodsList || []
    },
    attrsList(state) {
      return state.searchList.attrsList || []
    },
    trademarkList(state) {
      return state.searchList.trademarkList || []
    }
  }
}
